<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="./dist/index.js"></script>
  <title>Document</title>
</head>
<body>

  <button target-key="btn">上报按钮</button>
  <button>不上报按钮</button>

  <button class="js-error">触发js错误</button>
  <button class="promise-error">触发promise错误</button>

  <script>
    new tracker({
      requestUrl: 'http://localhost:9000/tracker',
      historyTracker: true,
      domTracker: true,
      jsError: true
    })

    function $(selector) {
      return document.querySelector(selector)
    }

    $('.js-error').addEventListener('click', e => {
      throw new Error('js-error')
    })
    $('.promise-error').addEventListener('click', e => {
      Promise.reject('promise-error')
    })

  </script>
</body>
</html>